package com.gjt.dlmall.product.config;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.redisson.api.RedissonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author gjt
 * @version 1.0
 * @date 2021/12/4 21:01
 */
@Configuration
public class MyRedissonConfig {
    /**
     *注册一个 redissonClient 对象
     * @return
     */
    @Bean(destroyMethod = "shutdown")
    RedissonClient redissonClient(){

        Config confing = new Config();
        //可以用“rediss://”来启用SSL连接
        confing.useSingleServer().setAddress("redis://127.0.0.1:6379");
        //默认连接地址 127.0.0.1:6379
        RedissonClient redissonClient = Redisson.create(confing);
        return redissonClient;
    }
}
